﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ednaview.aspx.cs" Inherits="ednaview" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>

    <script type="text/vbscript" language="vbscript">

Function GetCommaItem(psCommaString, piItemNumber) 
  'Pull an item out of a comma-delimited set of items
  
  Dim lsString 
  Dim liCurID 
  Dim liSepLoc 
  Dim liCount1
  Dim lsComma 

  lsComma = ","
  lsString = psCommaString
  liCount1 = 0

  Do While liCount1 < piItemNumber
    liSepLoc = InStr(lsString, lsComma)
    If liSepLoc = 0 Then
      liCurID = lsString
      lsString = ""
    Else
      liCurID = Mid(lsString, 1, liSepLoc - 1)
      lsString = Mid(lsString, liSepLoc + 1)
    End If
    liCount1 = liCount1 + 1
  Loop

  GetCommaItem = liCurID

End Function

Sub RTViewX_OnTrend(psTag,pStartTime,pEndTime,Limits, LowerLimit,UpperLimit)
  Dim lsTrendURL
  Dim lsTagQueryString
  Dim liNumValues
  Dim lsTag
  Dim i

  liNumValues =1
  lsTag = psTag
  While InStr(lsTag, ",")
    lsTag = Mid(lsTag, InStr(lsTag, ",") + 1)
    liNumValues = liNumValues + 1
  Wend
  
  
  lsTagQueryString = "NumValues=" & liNumValues
  
  for i = 1 to liNumValues
    lsTag = GetCommaItem(psTag,i)
    if (mid(lsTag,1,1)) = """" then
      lsTag = mid(lsTag,2)
    end if
    if (mid(lsTag,len(lsTag),1)) = """" then
      lsTag = Mid(lsTag,1,len(lsTag)-1)
    end if 
    lsTagQueryString = lsTagQueryString & "&Tag" & i & "=" & lsTag
  next
  
  
  lsTrendURL = "ednaview_trend.aspx?" & lsTagQueryString &"&StartTime=" & pStartTime & "&EndTime=" & pEndTime & "&Limits=" & Limits & "&LowerLimit=" & LowerLimit & "&UpperLimit=" & UpperLimit
  call window.open(lsTrendURL, "eDNAViewTrend","width=700,height=620,directories=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,resizeable=no")

End Sub

    </script>

    <script type="text/javascript">

        function request(strParame) {
            var args = new Object();
            var query = location.search.substring(1);

            var pairs = query.split("&"); // Break at ampersand 
            for (var i = 0; i < pairs.length; i++) {
                var pos = pairs[i].indexOf('=');
                if (pos == -1) continue;
                var argname = pairs[i].substring(0, pos);
                var value = pairs[i].substring(pos + 1);
                value = decodeURIComponent(value);
                args[argname] = value;
            }
            return args[strParame];
        } 
    </script>

</head>
<body>
    <div id="RTView">
        <object id="RTViewX" width="100%" height="100%" classid="CLSID:38131CD7-E306-41CC-9E87-1BA36C7D4D35"
            codebase="../ActiveX/eDNAWC23.cab#version=1,0,0,33">
        </object>
        <object width="0" height="0" classid="CLSID:38131CD7-E306-41CC-9E87-1BA36C7D4D35">
            <param name="ProxyIpPort" value="<%=ProxyIpPort%>" />
            <%--<%=ProxyIpPort%>--%>
        </object>
    </div>

    <script type="text/javascript">
        var rtView = document.getElementById("RTViewX");
        rtView.LaunchTrendInWeb = "True";
        rtView.ForceFlex = "false";
        rtView.ForceFlexSizing = "False";
        //rtView.ProxyIPPort = "172.16.29.151,9001";
        var filename ="WHSIS.APP:GL\\汽水系统.RTV";//request('fName')); //"<%=SourceFileURL%>" + request('FileName');
        rtView.DocumentName=filename.toString();
        
        //rtView.LoadWebFile(filename.toString());
    </script>

</body>
</html>
